;; supercollider/binop.scm - (c) rohan drape, 2003-2005

;; A list that maps symbolic binary operator names to integer
;; indexes.

(define binop-names 
  (make-global
   '(Add		
     Sub 
     Mul 
     IDiv 
     FDiv 
     Mod
     EQ		
     NE 
     LT 
     GT 
     LE
     GE
     ;;Identical
     ;;NotIdentical

     Min 
     Max
     BitAnd
     BitOr
     BitXor	
     LCM
     GCD
     Round
     RoundUp
     Trunc
     Atan2	
     Hypot
     Hypotx
     Pow
     ShiftLeft 
     ShiftRight 
     UnsignedShift 
     Fill 
     Ring1	
     Ring2	
     Ring3	
     Ring4	
     DifSqr	
     SumSqr	
     SqrSum	
     SqrDif	
     AbsDif	
     Thresh
     AMClip
     ScaleNeg
     Clip2
     Excess
     Fold2
     Wrap2
     FirstArg
     RandRange
     ExpRandRange)))

;; Evaluates to the 'SpecialIndex' for the symbolic binary operator
;; `name', or to '#f' if `name' is not a binary operator.  The names
;; are those used as enumeration constants in the SC3 source.

(define (binop-index name)
  (index (lambda (s) (eq? s name)) (binop-names)))

;; Evaluate to the symbolic name of the binary operation defined by
;; `special-index'.

(define (binop-name special-index) 
  (ref (binop-names) special-index))
